package com.atguigu.ggkt.vod.controller;

import com.atguigu.ggkt.response.Result;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zfj
 * @date 2022/7/8 -15:26
 */
@RestController
@RequestMapping("/admin/vod/user")
public class LoginController {

	/**
	 * 登录
	 *
	 * @return
	 */
	@PostMapping("/login")
	public Result login() {
		Map<String, Object> map = new HashMap<>();
		map.put("token", "admin-token");
		return Result.ok(map);
	}

	/**
	 * 获取用户信息
	 *
	 * @return
	 */
	@GetMapping("/info")
	public Result info() {
		/**
		 * data: {roles: ["admin"], introduction: "I am a super administrator",…}
		 * avatar: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"
		 * introduction: "I am a super administrator"
		 * name: "Super Admin"
		 */
		Map<String, Object> map = new HashMap<>();
		map.put("roles", "[admin]");
		map.put("name", "Super Admin");
		map.put("introduction", "I am a super administrator");
		map.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
		return Result.ok(map);
	}

	/**
	 * 退出
	 * @return
	 */
	@PostMapping("/logout")
	public Result logout(){
		return Result.ok();
	}
}
